#include "sensor_thread.h"

sensor_thread::sensor_thread()
{
    sensor=0.0;
    position=0;
}

void sensor_thread::run()
{
    while(true){
        get_position();
        qDebug()<<"整数"<<position;
        get_sensor();
        qDebug()<<"浮点数"<<sensor;
        msleep(100);
    }
}

void sensor_thread::get_position()
{
    position=QRandomGenerator::global()->bounded(1000);
}
void sensor_thread::get_sensor()
{
    sensor=QRandomGenerator::global()->bounded(499)+QRandomGenerator::global()->generateDouble();
}
